package com.atde._05_behavioral_design_patterns.strategy.improve;


/**
 * @BelongsProject: hsp_java_design_mode
 * @BelongsPackage: com.atde._05_behavioral_design_patterns.strategy.improve
 * @Author: Del
 * @CreateTime: 2025-06-30  15:51
 * @Description: 策略模式：鸭子抽象类
 * @Version: 1.0
 */
public abstract class Duck {

    // 策略接口
    FlyBechavior flyBechavior;

    public Duck() {
    }

    public Duck(FlyBechavior flyBechavior) {
        this.flyBechavior = flyBechavior;
    }

    public abstract void display();

    public void fly() {
        if (flyBechavior != null) {
            flyBechavior.fly();
        }
    }
}
